package com.example.common.utils;

import ma.glasnost.orika.MapperFacade;
import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.impl.DefaultMapperFactory;

public class BeanUtils {

    /**
     * Bean 转换
     * @return
     */
    public static MapperFacade facade(){
        MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
        MapperFacade mapperFacade = mapperFactory.getMapperFacade();
        return mapperFacade;
    }

    public static void main(String[] args) {
        MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
        /*mapperFactory.classMap(User.class, UserVo.class)
                .field("name", "userName")
                .field("age", "ageOne")
                .byDefault().register();*/


        //集合复制--使用mapAsList
        //List<UserVo> userVos = mapperFactory.getMapperFacade().mapAsList(A, UserVo.class);
        //对象复制--使用map
        //UserVo userVos = mapperFactory.getMapperFacade().map(A, UserVo.class);
    }
}
